﻿<cfsilent>
	<cfscript>
		
		jsonAdvice = getProperty("serviceFactory").getBean("jsonAdvice");

		response = structNew();
		structInsert(response, "success", false, true);

		taskId = event.getArg("TSK");
		taskType = event.getArg("TT");
		clsroomType = event.getArg("CRTP");
		
		transaction {
			
			/* 载入教学任务 */
			
			/* 修改教学班排课教室类别 */
			switch(taskType){
				case 'P':
					sql = "UPDATE t_task a 
							SET a.cr_type = :clsroomType 
							WHERE a.tsk_id = :taskId ";
					break;
				case 'C':
					sql = "UPDATE t_common_task a 
							SET a.cr_type = :clsroomType 
							WHERE a.tsk_id = :taskId ";
					break;
				case 'R':
					sql = "UPDATE t_reopen_task a 
							SET a.cr_type = :clsroomType  
							WHERE a.tsk_id = :taskId ";
					break;
				case 'T':
					sql = "UPDATE t_sport_task a 
							SET a.cr_type = :clsroomType 
							WHERE a.tsk_id = :taskId ";
					break;
			}
			
			updateObj = new Query(datasource=application.dnsMaster);
			updateObj.addParam(name="taskId", value=taskId, cfsqltype="cf_sql_varchar");
			updateObj.addParam(name="clsroomType", value=clsroomType, cfsqltype="cf_sql_char");
			updateObj.execute(sql=sql);
			
			structInsert(response, "success", true, true);
			
		}
		
		
	</cfscript>
</cfsilent><cfoutput>#jsonAdvice.encode(data:response, stringNumbers:true)#</cfoutput>